<template>
  <div>
    <div class="search">
      <span class="iconfont icon-sousuo" @click="click"></span>
      <el-input v-model="input" class="w-50 m-2" placeholder="请输入你的内容" />
    </div>
  </div>
</template>
<script>
import { ref } from "vue";
import { useStore } from "vuex";
import { ElInput } from "element-plus";
export default {
  //前面props必须要写
  setup(props, context) {
    const store = useStore();
    const input = ref("");
    const click = () => {
      store.commit("manage/biaoji", { flag: input.value });
      // 触发父组件
      context.emit("search", input.value);
      input.value = "";
    };
    return {
      input,
      click,
    };
  },
  component: {
    ElInput,
  },
};
</script>

<style lang="less" scoped>
.search {
  margin: 10px 0px;
  width: 16%;
  display: flex;
  align-items: center;
  background-color: #fff;
  border-radius: 5px;
  padding: 3px 3px 3px 5px;
  span {
    color: #777777;
    margin: 0px 5px;
    cursor: pointer;
    font-size: 20px;
    font-weight: 700;
  }
}
</style>
